package com.urbansquall.chaos{
	
import flash.utils.*;

/*
 *
 * */

public class RandomizedCombo
{
	private var m_categories : Dictionary;
	private var m_random : PseudoRandom;
	
	public function RandomizedCombo( a_random : PseudoRandom = null )
	{
		m_random = a_random;
		m_categories = new Dictionary();
	}
	
	public function createCategory( a_name : String, a_options : Array ) : void
	{
		var cycle : RandomizedCycle = new RandomizedCycle( m_random );
		for( var i : int = 0; i < a_options.length; i++ )
		{
			cycle.insert( a_options[ i ] );
		}
		
		m_categories[ a_name ] = cycle;
	}
	
	// returned dictionary will have an option for each category
	// and the category name is the key
	public function generateCombo() : Dictionary
	{
		var result : Dictionary = new Dictionary( true );
		
		for( var key : String in m_categories )
		{
			var cycle : RandomizedCycle = m_categories[ key ];
			result[ key ] = cycle.next;
		}
		
		return result;
	}
}

}